//
//  BottomView.swift
//  知乎日报
//
//  Created by Ann on 2017/10/12.
//  Copyright © 2017年 Ann. All rights reserved.
//

import UIKit

class BottomView: UIView {
    var menu_Download:UIButton = {
    let btn = UIButton()
        btn.setImage(UIImage(named:"Menu_Download"), for: UIControlState.normal)
        return btn
    }()
    
    
    var menu_Dark:UIButton = {
        let btn = UIButton()
        btn.setImage(UIImage(named:"Menu_Dark"), for: UIControlState.normal)
        return btn
    }()
    
    var downloadLabel:UILabel = {
    let lab = UILabel()
        lab.text = "离线"
        lab.textColor = userViewLabelColor
        lab.font = UIFont.systemFont(ofSize: 14)
        return lab
    
    }()
    var darkLabel:UILabel = {
        let lab = UILabel()
        lab.text = "夜间"
        lab.textColor = userViewLabelColor
        lab.font = UIFont.systemFont(ofSize: 14)
        return lab
        
    }()
    override init(frame: CGRect) {
        super.init(frame: frame)
        setupUI()
       
     let p = CGPath(rect: CGRect.init(x: 0, y: -10, width: userScreenWidth, height: 20), transform: nil)
        self.layer.shadowPath = p
        self.layer.shadowColor = userViewBackground.cgColor
        self.layer.shadowOpacity = 1
    }
    func setupUI(){
        addSubview(menu_Dark)
        addSubview(menu_Download)
        addSubview(downloadLabel)
        addSubview(darkLabel)
        
    layoutView()
        
        menu_Download.sizeToFit()
        downloadLabel.sizeToFit()
        menu_Dark.sizeToFit()
    darkLabel.sizeToFit()
    }
    func layoutView(){
    menu_Download.snp.makeConstraints { (make) in
        make.left.equalTo(self.snp.left).offset(iconMargin)
        make.centerY.equalTo(self.snp.centerY)
        
        }
        downloadLabel.snp.makeConstraints { (make) in
            make.left.equalTo(menu_Download.snp.right).offset(iconMargin)
            make.centerY.equalTo(menu_Download.snp.centerY)
            
        }
        menu_Dark.snp.makeConstraints { (make) in
            make.left.equalTo(downloadLabel.snp.right).offset(userScreenWidth/3)
            make.centerY.equalTo(self.snp.centerY)
        }
        
    darkLabel.snp.makeConstraints { (make) in
        make.left.equalTo(menu_Dark.snp.right).offset(iconMargin)
        make.centerY.equalTo(menu_Dark.snp.centerY)
        }
    }
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

}
